import requests
from lxml import etree
url = 'https://so.gushiwen.cn/user/login.aspx?from=http%3a%2f%2fso.gushiwen.cn%2fuser%2fcollect.aspx'

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26"
}

res=requests.get(url=url,headers=headers)
con=res.text
#etree.HTML(con).
#获取验证码
code_url='https://so.gushiwen.cn/RandCode.ashx'
session=requests.session()
code_img=session.get(url=code_url).content
print(code_img)
with open(file="code_img.gif",mode='wb') as fp:
    fp.write(code_img)

code_url=input("请输入验证码")
data={
    '__VIEWSTATE': '',
'__VIEWSTATEGENERATOR': 'C93BE1AE',
'from': 'http://so.gushiwen.cn/user/collect.aspx',
'email': '19170213606',
'pwd': 'W1376765165w',
'code': code_url,
'denglu': '登录'
}
#res=requests.post(url=url,data=data,headers=headers)
